-
Notifications
You must be signed in to change notification settings - Fork 55
feat: add smart hide when hide desktop. #1163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR implements smart hiding by monitoring _NET_WM_STATE changes (including empty state for Win+D), updating each window’s minimized/hidden status accordingly, and ensuring hidden or minimized windows do not overlap the dock. Sequence diagram for smart window hiding on _NET_WM_STATE changessequenceDiagram
participant X11DockHelper
participant XcbHelper
participant WindowData
participant Dock
actor User
User->>X11DockHelper: Triggers Win+D or window state change
X11DockHelper->>XcbHelper: getAtomByName("_NET_WM_STATE")
X11DockHelper->>XcbHelper: getWindowState(window)
XcbHelper-->>X11DockHelper: Returns window state atoms
X11DockHelper->>WindowData: Update isMinimized based on state (HIDDEN, BELOW, SKIP_TASKBAR, or empty)
X11DockHelper->>X11DockHelper: updateWindowHideState(window)
X11DockHelper->>WindowData: Set overlap = false if minimized/hidden
WindowData-->>Dock: No overlap with dock if hidden/minimized
Class diagram for updated window state and overlap logicclassDiagram
class X11DockHelper {
+void onWindowPropertyChanged(xcb_window_t, xcb_atom_t)
+void updateWindowHideState(xcb_window_t)
}
class XcbHelper {
+QList<xcb_atom_t> getWindowState(xcb_window_t)
+xcb_atom_t getAtomByName(QString)
}
class WindowData {
bool isMinimized
QRect rect
bool overlap
}
X11DockHelper --> XcbHelper : uses
X11DockHelper --> WindowData : updates
WindowData --> X11DockHelper : overlap updated
XcbHelper <.. X11DockHelper : queried for atoms and state
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @wjyrich - I've reviewed your changes and found some issues that need to be addressed.
Blocking issues:
- Undefined variable 'states' used here (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `panels/dock/x11dockhelper.cpp:442` </location>
<code_context>
+ m_windows[window]->isMinimized = m_xcbHelper->getWindowState(window).contains(m_xcbHelper->getAtomByName("_NET_WM_STATE_HIDDEN"));
+ // 检查窗口是否被隐藏
+ // Win+D时窗口状态会被清空,这也表示窗口被隐藏
+ bool isWindowHidden = states.contains(m_xcbHelper->getAtomByName("_NET_WM_STATE_HIDDEN")) ||
+ states.contains(m_xcbHelper->getAtomByName("_NET_WM_STATE_BELOW")) ||
+ states.contains(m_xcbHelper->getAtomByName("_NET_WM_STATE_SKIP_TASKBAR")) ||
</code_context>
<issue_to_address>
Undefined variable 'states' used here
`states` is used without being defined. Please assign the result of `m_xcbHelper->getWindowState(window)` to a local variable named `states` before referencing it.
</issue_to_address>
### Comment 2
<location> `panels/dock/x11dockhelper.cpp:439` </location>
<code_context>
onWindowWorkspaceChanged(window);
+ } else if (atom == m_xcbHelper->getAtomByName("_NET_WM_STATE")) {
+ bool wasMinimized = m_windows[window]->isMinimized;
+ m_windows[window]->isMinimized = m_xcbHelper->getWindowState(window).contains(m_xcbHelper->getAtomByName("_NET_WM_STATE_HIDDEN"));
+ // 检查窗口是否被隐藏
+ // Win+D时窗口状态会被清空,这也表示窗口被隐藏
</code_context>
<issue_to_address>
Initial isMinimized assignment is overwritten
Compute `isWindowHidden` first, then assign `isMinimized` once to avoid redundant assignments.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
BLumia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果不是本阶段必解的话,应该改监听 org.kde.KWin 的 ShowingDesktopStateChanged
as title. PMS-BUG-309173
deepin pr auto review代码审查意见:
总体来说,代码的改动提高了代码的可读性和可维护性,并且添加了新的功能来处理显示桌面状态。但是,需要进一步确认最小化窗口状态变化对 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, wjyrich The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| "showingDesktopChanged", | ||
| this, | ||
| SLOT(onShowingDesktopChanged(bool)) | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要同步下m_showingDesktop的状态吧,
as title.
PMS-BUG-309173
Summary by Sourcery
Implement smart-hide on desktop-hide actions by monitoring window state transitions and updating dock visibility accordingly
New Features:
Enhancements: